<?php

namespace FileSystem;

/**
 * Class FileSystem
 * @author hwz
 */
class FileSystem {

    protected $adapter;

    /**
     * __construct
     * @return void
     * @author hwz
     **/
    public function __construct($driver,$params) {
        $class = "FileSystem\\drivers\\$driver";
        /* if (class_exists($class)) {
            throw new \Exception("驱动 $class 不存在");
        } */

        if (isset($params['root'])) {
            $params['root'] = rtrim($params['root'],'/') . '/';
        }
        $this->adapter = new $class($params);
    }

    /**
     * __call
     * @return void
     * @author hwz
     **/
    public function __call($method,$params) {
        return call_user_func_array(array( $this->adapter,$method ),$params);
    }
}
